home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / READ.ASM < prev    next >
Assembly Source File  |  1987-06-25  |  1KB  |  44 lines

  1. ;    DESC:    Reads data from a file                               V1.00
  2. ;    IN:    *{HANDLE} handle of file
  3. ;        *{NUM_BYTES} number of bytes requested to read from file
  4. ;        *{SEG_VAL} segment and
  5. ;        *{OFFSET} offset of buffer
  6. ;    OUT:    *{NUM_READ} number of bytes actually read
  7. ;    SAMPLE:    Callm    READ,<HANDLE,NUM_BYTES,SEG_VAL,OFFSET>,<NUM_READ>
  8. ;    ################################################################## 
  9.  
  10.     Extrn    PUSHALL:Near
  11.     Extrn    POPALL:Near
  12.     Extrn    ERRORMSG:Near
  13.  
  14. READC    Segment
  15.     Assume    CS:READC
  16.     Public    READ
  17.  
  18.                         ;notice.
  19.     DB    'READ     - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  20.  
  21. READ    Proc    NEAR                ;reads a file.
  22.     Call    PUSHALL
  23.  
  24.     Pop    DX                ;get buffer offset.
  25.     Pop    DS                ;get buffer segment.
  26.     Pop    CX                ;get the number of bytes
  27.                         ;to read.
  28.     Pop    BX                ;get the handle.
  29.  
  30.     Mov    AH,3FH                ;read a file.
  31.     Int    21H
  32.     Jc    ERROR                ;if an error report it.
  33.  
  34.     Push    AX
  35.     Call    POPALL
  36.     Ret
  37.  
  38. ERROR:    Push    AX                ;report error and abort.
  39.     Call    ERRORMSG
  40.  
  41. READ    Endp
  42. READC    Ends
  43.     End
  44.